Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed zero insertion when concatenate sparse matrices with 0*I #21657

Merged
merged 1 commit into from
May 3, 2017
Merged

Fixed zero insertion when concatenate sparse matrices with 0*I #21657

merged 1 commit into from
May 3, 2017

Conversation

iamnapo
Copy link
Contributor

@iamnapo iamnapo commented May 1, 2017

Fixes #21563

@tkelman
Copy link
Contributor

tkelman commented May 1, 2017

LGTM, but is a behavior change so should merge post-branching

@iamnapo
Copy link
Contributor Author

iamnapo commented May 1, 2017

merge post-branching

What do you mean?

@StefanKarpinski
Copy link
Member

@tkelman means that we shouldn't merge this change until after the release-0.6 branch is created because this is a user-visible behavior change (albeit not likely to be a terribly breaking one).

@iamnapo
Copy link
Contributor Author

iamnapo commented May 1, 2017

Oh, cool.

@@ -47,12 +47,18 @@ end
@testset "concatenation tests" begin
@testset "horizontal concatenation" begin
@test all([se33 se33] == sparse([1, 2, 3, 1, 2, 3], [1, 2, 3, 4, 5, 6], ones(6)))

sp33 = speye(3, 3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sp33 definition seems unnecessary given its absence in the immediately following test, and likewise two lines below? Or am I missing something? (Also, why the additional empty lines?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, thanks!

@testset "horizontal concatenation" begin
@test all([se33 se33] == sparse([1, 2, 3, 1, 2, 3], [1, 2, 3, 4, 5, 6], ones(6)))
@test all([se33 se33] == sparse([1, 2, 3, 1, 2, 3], [1, 2, 3, 4, 5, 6], ones(6)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace failure on this line?

@kshyatt kshyatt added the sparse Sparse arrays label May 2, 2017
Copy link
Member

@Sacha0 Sacha0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @iamnapo! (Absent objections, requests for time, or someone beating me to it, I plan to merge this tomorrow morning. Best!)

@Sacha0 Sacha0 merged commit 0155f51 into JuliaLang:master May 3, 2017
@Sacha0
Copy link
Member

Sacha0 commented May 3, 2017

Thanks @iamnapo!

@@ -1430,6 +1430,9 @@ speye_scaled(diag, m::Integer, n::Integer) = speye_scaled(typeof(diag), diag, m,

function speye_scaled(T, diag, m::Integer, n::Integer)
((m < 0) || (n < 0)) && throw(ArgumentError("invalid array dimensions"))
if iszero(diag)
return SparseMatrixCSC(m, n, ones(Int, n+1), Vector{Int}(0), Vector{T}(0))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not very consequential, but I wonder how often this gets called in a way that makes the Int(m), Int(n) conversions below necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think none. I even think the ones below are unnecessary, now that you mention it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe if you called it directly with a non Int sized integer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't the constructor of SparseMatrixCSC take care of that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it looks like the SparseMatrixCSC constructor takes care of the Int conversions, so they could be removed here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I think is easier if someone changes it directly, instead of me opening another PR just for that.)

@iamnapo iamnapo deleted the napo/0I_zeroinsert branch May 3, 2017 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sparse Sparse arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants